[SUBROUTINE]
version = 1.14
icon = l-stock.png
name = _("Workpiece")
type = workpiece
help = _("<b>Workpiece or raw material used</b>")
order = sh h1 od id l z h2 wmode x_rap z_rap

[PARAM_SH]
name = _("Show limits")
type = bool
value = 0

[PARAM_H1]
name = _("Size and coord")
type = sub-header

[PARAM_OD]
name = _("Ext. diameter")
type = float
value = 2.0
metric_value = 50.0
minimum_value = 0.0
not_allowed = 0
icon = e-diam.png
header = h1

[PARAM_ID]
name = _("Int. diameter")
type = float
value = 0.0
metric_value = 0.0
minimum_value = 0.0
tool_tip = _("Only if hollow")
header = h1
icon = i-diam.png

[PARAM_L]
name = _("Length")
type = float
value = 10.0
metric_value = 250.0
minimum_value = 0.0
not_allowed = 0
header = h1
icon = width.png

[PARAM_Z]
name = _("Begin position")
type = float
value = 0.0
metric_value = 0.0
tool_tip = _("Z coord at tip")
header = h1
icon = z.png

[PARAM_H2]
name = _("Params")
type = sub-header

[PARAM_WMODE]
name = _("Work mode")
type = combo
icon = circle-rad-dia.png
header = h2
options = _("Diameter=7:Radius=8")
value = 7

[PARAM_X_RAP]
name = _("Safe X rapid")
type = float
icon = lathe-rappid-x.png
value = 1.0
metric_value = 25.0
minimum_value = 0.0
not_allowed = 0
tool_tip = _("When job is done")
header = h2

[PARAM_Z_RAP]
name = _("Safe Z rapid")
type = float
icon = lathe-rappid-z.png
header = h3
tool_tip = _("When job is done")
value = 1.0
metric_value = 25.0
minimum_value = 0.0
not_allowed = 0
header = h2

[VALIDATION]
content =
	if self.check_hash('#param_od', 1) <= self.check_hash('#param_id', 1) :
		VALIDATED = False
		self.msg_inv(_('External diameter must be greater than the internal'), 1)


[CALL]
content =
	(begin #sub_name)
	(author : Fernand Veilleux)
	
	G#param_wmode (Diameter = 7, Radius = 8)
	#<_diameter_mode> = [#<_lathe_diameter_mode> + 1] (value is 1 for radius and 2 for diameter)
	
	#<_wp_dia_od> = [#param_od / 2 * #<_diameter_mode>]
	#<_wp_dia_id> = [#param_id / 2 * #<_diameter_mode>]
	
	#<_x_rapid>  = [#param_x_rap * #<_diameter_mode>]
	#<_z_rapid>  = #param_z_rap
	
	/ o<#self_id1> if [#param_sh EQ 1]
		/ o<show_stock> CALL [#param_z] [#param_l]
	/ o<#self_id1> endif
	
	(end #sub_name)
